package com.qfedu.controller;

import com.github.pagehelper.Page;
import com.qfedu.common.JsonResult;
import com.qfedu.service.SignService;
import com.qfedu.vo.SignEcharts;
import com.qfedu.vo.VSign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author 刘浩
 * @Date 2020/9/1 15:43
 */
@Controller
@RequestMapping("/sign")
public class SignController {
    @Autowired
    private SignService signService;

    @RequestMapping("/all.do")
    @ResponseBody
    public Map<String,Object> all(Integer page, Integer limit, String name){
        System.out.println(name);
        if (null == name) {
            name = "";
        }
        List<VSign> vSigns = signService.selectSign(page, limit, name);
        Map<String, Object> map = new HashMap<>();
        long total = ((Page) vSigns).getTotal();

        map.put("code", 0);
        map.put("msg", "");
        map.put("count", total);
        map.put("data", vSigns);
        return map;
    }

    @RequestMapping("/form.do")
    @ResponseBody
    public SignEcharts tb(){
        return signService.tb();
    }
}
